package com.ajhlp.spring_modules.db.multiSource.metaModel;
/**
 * 数据字段查询方式
 * @author ajhlp
 *
 */
public enum DBSource_DataField_QueryType {

	/**
	 * 精确配置
	 */
	ACCURATE("ACCURATE"),
	/**
	 * 模糊匹配
	 */
	APPROXIMATE("APPROXIMATE"),
	/**
	 * 区间匹配
	 */
	INTERVAL("INTERVAL");
	
	private String type ;
	
	private DBSource_DataField_QueryType(String type){
		this.type = type;
	}
	/**
	 * 获得查询方式值
	 * @return
	 */
	public String getType(){
		return this.type;
	}
	
	/**
	 * 通过方式值得到查询方式枚举对象
	 * @param name
	 * @return
	 */
	public static DBSource_DataField_QueryType forName(String name){
		if(name == null){
			throw new IllegalArgumentException("name must not null");
		}
		
		if(name.toUpperCase().equals("ACCURATE")){
			return DBSource_DataField_QueryType.ACCURATE;
		}else if(name.toUpperCase().equals("APPROXIMATE")){
			return DBSource_DataField_QueryType.APPROXIMATE;
		}else if(name.toUpperCase().equals("INTERVAL")){
			return DBSource_DataField_QueryType.INTERVAL;
		}
		
		throw new IllegalArgumentException("no match name was founded");
	}
}
